package exception;

/**
 *
 */
public class FinallyDemo2 {
    public static void main(String[] args) {
        System.out.println(test("0")+","+test(null)+","+test(""));
    }
    public static int test(String str){
        try {
            return str.charAt(0)-'0';
        } catch (NullPointerException e) {
            return 1;
        }catch (Exception e) {
            return 2;
        }finally {
            //finally里面不应该有return，要不然返回值永远是return
            return 3;
        }
    }
}
